package com.zhanglijie.base.datamoveprodandconsume;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/3/13 0013 2:03
 */
public class Test {
    //演示开启两个线程消费
    public static void main(String[] args) throws InterruptedException {
        //下面方式存在问题  每个MyConsumer1都有自己的数据
        //   MyConsumer1 thread1 = new MyConsumer1();
        //   MyConsumer1 thread2 = new MyConsumer1();
        //   thread1.start();
        //   thread2.start();
        //解决上面的问题就是将数据static
        // MyConsumer2 thread1 = new MyConsumer2();
        // MyConsumer2 thread2 = new MyConsumer2();
        // MyConsumer2 thread3 = new MyConsumer2();
        // MyConsumer2 thread4 = new MyConsumer2();
        // thread1.start();
        // thread2.start();
        // thread3.start();
        // thread4.start();
        //解决jmm问题

            MyConsumer3 thread1 = new MyConsumer3();
            MyConsumer3 thread2 = new MyConsumer3();
            MyConsumer3 thread3 = new MyConsumer3();
            MyConsumer3 thread4 = new MyConsumer3();
            MyConsumer3 thread5 = new MyConsumer3();
            MyConsumer3 thread6 = new MyConsumer3();
            MyConsumer3 thread7 = new MyConsumer3();
            MyConsumer3 thread8 = new MyConsumer3();
            MyConsumer3 thread9 = new MyConsumer3();
            MyConsumer3 thread10 = new MyConsumer3();
            thread1.start();
            thread2.start();
            thread3.start();
            thread4.start();
            thread5.start();
            thread6.start();
            thread7.start();
            thread8.start();

            thread9.start();
            thread10.start();

    }
}
